package com.tjetc.字节流;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;

public class T04字节缓冲流 {
    public static void main(String[] args) throws IOException {
        /*BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new FileOutputStream("a.txt"));
        bufferedOutputStream.write(97);
        bufferedOutputStream.write("hello".getBytes());
        bufferedOutputStream.write("hello".getBytes(),1,3);
        bufferedOutputStream.close();*/
        BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream("a.txt"));
        byte[] bytes = new byte[1024];
        //每次接多少滴水
        int num;
        while((num=inputStream.read(bytes))!=-1){
            System.out.println(new String(bytes,0,num));
        }
        inputStream.close();
    }
}
